import Gird from "../graphics/common";


const { ccclass, property } = cc._decorator;

@ccclass
export default class labPre extends cc.Component {

    @property(cc.Label)
    fLab: cc.Label = null;

    @property(cc.Node)
    colorCube: cc.Node = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start() {

    }

    // update (dt) {}

    setFlab(cubeInfo: Gird) {
        if (cubeInfo.f) {
            this.fLab.string = `f=${cubeInfo.f}`
        }
        if (cubeInfo.parent) {
            if (cubeInfo.parent.x < cubeInfo.x) {
                this.colorCube.x = -20
            } else if (cubeInfo.parent.x == cubeInfo.x) {
                this.colorCube.x = 0
            } else if (cubeInfo.parent.x > cubeInfo.x) {
                this.colorCube.x = 20
            }
            if (cubeInfo.parent.y < cubeInfo.y) {
                this.colorCube.y = -20
            } else if (cubeInfo.parent.y == cubeInfo.y) {
                this.colorCube.y = 0
            } else if (cubeInfo.parent.y > cubeInfo.y) {
                this.colorCube.y = 20
            }
        }

    }
}
